<template>
  <div>
    <div v-for="(value,index) in refundLists">
      <slot name='top'>
        <div class="top">
          {{value.shopName}}
        </div>
      </slot>
      <div class="good clearfix ">
        <div class="left">
          <img :src='value.image' align="absmiddle" />
        </div>
        <div class="right relative">
          <p class="firstP">{{value.name}}</p>
          <p>
            <span class=' showColor opacity'>{{value.specification()}}</span>
          </p>
          <p class="lastP">
            <span class="money">￥{{value.price}}</span>
            <!-- <span v-if="marks" class="positionRight opacity">{{value.goodWeight}}kgx{{value.goodNum}}</span> -->
            <span class="positionRight opacity">{{value.status}}</span>
          </p>
        </div>
      </div>
      <p class="goodBottom">
        <router-link to= "/refundDetail">
           查看详情
        </router-link>
      </p>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    orderId: { type: Number },
    mark: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      orderId_: this.orderId,
      refundLists: [],
      marks: this.mark,
      refundStatus: ['退款中', '退款完成', '']
    }
  },
  computed: {
    refundList() {
      this.$store.state.refundData.then(data => {
        this.refundLists = data
        for (var i = 0; i < data.length; i++) {
          if (data[i].status == 5) {
            this.refundLists[i].status = this.refundStatus[0]
          }
          if (data[i].status == 6) {
            this.refundLists[i].status = this.refundStatus[1]
          }
        }
        if (this.orderId_ === 1) {
          this.refundLists = data.filter(function(value) {
            return value.id == 1
          })
          this.refundLists[0].status = this.refundStatus[2]
        }
      })
    }
  },
  watch: {
    refundList() {}
  }
}
</script>

<style scoped>
.top {
  height: 2rem;
  line-height: 2rem;
  background: rgb(241, 240, 243);
  padding-left: 2%;
}

.good {
  width: 100%;
  height: 4rem;
  padding: 1rem 0;
  border-top: 2px solid #f0f0f0;
  border-bottom: 2px solid #f0f0f0;
}

.left {
  width: 25%;
  float: left;
}

.left img {
  width: 75%;
  margin-left: 10%;
}

.right {
  width: 70%;
  float: left;
  padding-left: 5%;
}

.right .firstP {
  font-size: 0.9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  padding-right: 5%;
}

.showColor {
  font-size: 0.8rem;
}

.money {
  color: red;
  font-size: 1.1rem;
}

.opacity {
  opacity: 0.4;
}

.positionRight {
  position: absolute;
  right: 5%;
  font-size: 0.8rem;
}
.goodBottom {
  border-bottom: 3px solid #f0f0f0;
  height: 3rem;
  line-height: 3rem;
  text-align: right;
}
.goodBottom a {
  padding: 0.2rem 1rem;
  font-size: 0.8rem;
  border: 1px solid darkgray;
  border-radius: 15px;
  margin-right: 1rem;
  color: #333 !important;
}
</style>